package com.jy.rhin.support.polymorphism.convertor;

import cn.org.chiss.rhin._2015.document.management.DocumentStoredQueryResponse;
import com.jy.rhin.sdk.dto.document.DocumentResultDto;
import com.jy.rhin.sdk.dto.document.DocumentSubmissionSetDto;
import com.jy.rhin.sdk.dto.document.query.GetSubmissionSetsDto;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author dhl
 * @date 2022/6/22
 * @Description
 */
@Service("getSubmissionSets")
public class DocumentQueryHandler4GetSubmissionSets extends AbstractDocumentQueryHandler<GetSubmissionSetsDto, DocumentSubmissionSetDto>{
    @Override
    GetSubmissionSetsDto convertReq(Map<String, List<String>> dtoValueMap) {
        GetSubmissionSetsDto dto = new GetSubmissionSetsDto();
        dto.setIdList(QueryValueUtils.getListValue("$EntryUUID", dtoValueMap));
        dto.setHomeCommunityId(QueryValueUtils.getStringValue("$HomeCommunityId", dtoValueMap));
        return dto;
    }

    @Override
    DocumentResultDto<DocumentSubmissionSetDto> query(GetSubmissionSetsDto dto) {
        return documentSubmissionQueryHandler.getSubmissionSets(dto);
    }

    @Override
    DocumentStoredQueryResponse convertResp(List<DocumentSubmissionSetDto> resultList, List<String> jsonTextList) {
        return submissionSetConvert(jsonTextList);
    }
}
